First, in Vagrantfile make sure the forwarded ports reflect the code below (Jupyter notebook uses port 8888):
config.vm.network "forwarded_port", guest: 8888, host: 8888
or (you can access iPython Jupyter at 127.0.0.1 instead of 127.0.0.1:888):
config.vm.network "forwarded_port", guest: 8888, host: 80
1. Install Python 2.7 and Pip
First login to vm with ssh:
$ vagrant ssh
Then,
$ sudo apt-get update
$ sudo apt-get -y install python2.7 python-pip python-dev
To verify that you have python installed:
$ python --version
You can also check if pip is installed using the following command:
$ pip --version
2. Install Ipython and Jupyter Notebook
$ sudo apt-get -y install ipython ipython-notebook
$ sudo -H pip install jupyter
ERRORS & SOLUTIONS: Depending on what version of pip is in the Ubuntu apt-get repository, you might get the following error when trying to install Jupyter:
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Use pip to upgrade pip to the latest version:
$ sudo -H pip install --upgrade pip
After pgrading pip, try installing Jupyter again:
$ sudo -H pip install jupyter
3. Running Jupyter Notebook
You can start jupyter notebook with an extra config line of ‘–ip=0.0.0.0’. This tells jupyter to listen on any IP address. This is the only way I can run jupyter notebook while using vagrant.
http://pythondata.com/vagrant-on-windows/ and http://pythondata.com/jupyter-vagrant/
$ jupyter notebook --ip=0.0.0.0
Access Jupyter by going to:
http://127.0.0.1:8888 or (http://127.0.0.1 if you chose the second option above)
and copy/paste the token you see in the command line into the password field. You will have to copy/paste the login token (after …?token=) in the command line output into the login field of jupyter.
Next, we can also configure the Python environment
Installing Python Libraries